/* uDig - User Friendly Desktop Internet GIS client
 * http://udig.refractions.net
 * (C) 2004-2008, Refractions Research Inc.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation;
 * version 2.1 of the License.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 */
package symbology;

import java.util.ArrayList;

import feature.Attribute;
import feature.Feature;


/**
 * TODO Purpose of 
 * <p>
 *
 * </p>
 * @author John
 * @since 1.1.0
 */
public class LabelSymbolizer implements Symbolizer {
    public String fieldName;  // Note: may want to cache field index
    public TextSymbol textSymbol;
    
    public LabelSymbolizer(String fieldName, TextSymbol textSymbol) {
        this.fieldName = fieldName;
        this.textSymbol = textSymbol;
    }


    public void addSymbols( Feature feature, double scale, Symbols symbols )
    {
        // Get the text string to use as a label
        String text = feature.getValueAsString(fieldName);
      
        
        // Add a new text symbol like the prototype, but with the new text
        TextSymbol symbol = new TextSymbol(text, textSymbol);
        symbols.add(symbol);
           
    }

}
